package cn.yunhe.controll;

import cn.yunhe.model.UserRegs;
import cn.yunhe.services.SerRent;

public class RegsAction extends BaseAction{

	  private UserRegs userRegs;
	  private String name;
	  private String password;
	  SerRent serRent = new SerRent();
	  
	  public String reg() {
		
		  int falg= serRent.addUser(userRegs);
		  
		if(falg>0) {
			return SUCCESS; 
		}else {
			return ERROR;
		}
	}
	
	  public String login() {
		  
		UserRegs falg = serRent.login(name, password);
		if(falg!=null) {
			getSession().setAttribute("userRegs", falg);
			if("user".equals(falg.getIsadmin())) 
			return SUCCESS; 
			else
			return "fabu";
			
		
		}else {
			return "err";
		}
		  
	  }
	  
	  public UserRegs getUserRegs() {
		return userRegs;
	}
	public void setUserRegs(UserRegs userRegs) {
		this.userRegs = userRegs;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}


	
	
	  
	  
}
